#!/bin/sh
i=0;
OK=1;
echo "Testing regexp";
for x in $(cat tests/test-regexp)
do
	./grep-line $x tests/texto > tests/cases/tmp 2> /dev/null
	R=$(diff -q tests/cases/tmp tests/cases/regexp-$i.out);
	if [ -n "$R" ]
		then
			OK=0
			echo 'Falló la expresión regular "'$x'" numero de test:"'$i'"';
			echo 'expected:';
			echo '';
			cat tests/cases/regexp-$i.out;
			echo '';
			echo 'Got:';
			echo '';
			cat tests/cases/tmp;
	fi;
	i=$(($i+1));
done;
rm -f tests/cases/tmp
if [ $OK -eq "1" ]
	then
		echo "Test regexp OK!";
fi;


